﻿package igz.fleaxy.ui.menu
{
	import flash.display.Sprite;
	import flash.events.MouseEvent;
	import igz.fleaxy.pattern.Dto;
	
	/**
	 * @author Intelygenz | www.intelygenz.com
	 */
	public class AbstractMenuItemUi extends Sprite {

		protected var _ItemDto:Dto;
		public function get $ItemDto() : Dto {
			return _ItemDto;
		}

		protected var _MyContainerUi:AbstractMenuContainerUi;
		public function get $MyContainerUi():AbstractMenuContainerUi {
			return _MyContainerUi;
		}

		protected var _ChildContainerUi:AbstractMenuContainerUi;
		public function set $ContainerChild( p_containerChildUi:AbstractMenuContainerUi ):void {
			_ChildContainerUi = p_containerChildUi;
		}

		public function AbstractMenuItemUi( p_myContainerUi:AbstractMenuContainerUi, p_menuItemDto:Dto ) {
			_MyContainerUi = p_myContainerUi;
			_ItemDto	   = p_menuItemDto;

			$Enable();

			tabEnabled = false;
		}

		protected function  _Mouse_OnRollOver ( p_mouseEvent:MouseEvent ) : void {
			
		}
		
		protected function  _Mouse_OnRollOut ( p_mouseEvent:MouseEvent ) : void {
			
		}
		
		protected function  _Mouse_OnClick ( p_mouseEvent:MouseEvent ) : void {
			
		}

		public function $Disable () : void {
			buttonMode = false;
			useHandCursor = false;
			removeEventListener(MouseEvent.ROLL_OVER, _Mouse_OnRollOver);
			removeEventListener(MouseEvent.ROLL_OUT, _Mouse_OnRollOut);
			removeEventListener(MouseEvent.CLICK, _Mouse_OnClick);
		}
		
		public function $Enable () : void {
			buttonMode = true;
			useHandCursor = true;
			addEventListener(MouseEvent.ROLL_OVER, _Mouse_OnRollOver);
			addEventListener(MouseEvent.ROLL_OUT, _Mouse_OnRollOut);
			addEventListener(MouseEvent.CLICK, _Mouse_OnClick);
		}
	}
	
}
